<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../css/bootstrap.min.css">
    <link rel="stylesheet" href="../css/gouwu.css">
</head>

<body>
    <!-- 首页 -->
    <div class="head">
        <ul>
            <li><a href="">品牌介绍</a>
                <p>ABOUT BRAND</p>
            </li>
            <li><a href="">产品中心</a>
                <p>PRODUCTS</p>
            </li>
            <li><a href="">招商加盟</a>
                <p> JION US</p>
            </li>
            <li><a href="">旺铺展示</a>
                <p>SHOP DISPLAY</p>
            </li>
            <li><a href="">新闻中心</a>
                <p> NEWS</p>
            </li>
            <li><a href="">联系我们</a>
                <p> CONTACT US</p>
            </li>
        </ul>
        <!-- 首页 -->
        <!-- 头部 -->
        <div class="bj">
        </div>
        <div class="swuper">
            <strong>产品中心&nbsp;|&nbsp;PRODUCTS</strong>
            <span><a href="neichadian.html">主页</a>><a href="">产品中心</a></span>
        </div>
    </div>
    <!-- 头部 -->
    <br>
    <!-- 商品 -->
    <table class="table  table-striped container" id="tab">
        <thead>
            <tr class="success">
                <th>奶茶</th>
                <th>价格</th>
                <th>数量</th>
                <th>小计</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td><img src="../img/taba1.png" alt=""></td>
                <td>￥8.3</td>
                <td><button>-</button><span>0</span><button>+</button></td>
                <td>0</td>
            </tr>
            <tr>
                <td><img src="../img/tab2.png" alt=""></td>
                <td>￥7.4</td>
                <td><button>-</button><span>0</span><button>+</button></td>
                <td>0</td>
            </tr>
            <tr>
                <td><img src="../img/tab3.png" alt=""></td>
                <td>￥8.9</td>
                <td><button>-</button><span>0</span><button>+</button></td>
                <td>0</td>
            </tr>
            <tr>
                <td><img src="../img/tab4.png" alt=""></td>
                <td>￥7.2</td>
                <td><button>-</button><span>0</span><button>+</button></td>
                <td>0</td>
            </tr>
            <tr>
                <td><img src="../img/tab5.png" alt=""></td>
                <td>￥8.9</td>
                <td><button>-</button><span>0</span><button>+</button></td>
                <td>0</td>
            </tr>
            <tr>
                <td><strong>总计</strong></td>
                <td></td>
                <td></td>
                <td></td>
            </tr>
        </tbody>
    </table>
    <div class="zfk"><button id="zf">支付</button></div>
    <!-- 商品 -->
    <br>
    <div class="zf" id="zft">
    </div>
    <div class="footer">
        <div class="ftWrap">
            <br>
            <div class="container relate">
                <div class="items">
                    <div class="tit"><strong>品牌介绍</strong></div>
                    <div class="con">
                        <a href="">品牌介绍</a>
                        <a href="">旺铺展示</a>
                        <a href="">新闻中心</a>
                    </div>
                </div>
                <div class="items">
                    <div class="tit"><strong>客服中心</strong></div>
                    <div class="con">
                        <a href="">品牌介绍</a>
                        <a href="">联系我们</a>
                        <a href="">网站地图</a>
                    </div>
                </div>
                <div class="items">
                    <div class="tit"><strong>产品中心</strong></div>
                    <div class="con">
                        <a href="">蜜雪莓果</a>
                        <a href="">摩天脆脆</a>
                        <a href="">蜜雪咖啡</a>
                    </div>
                </div>
                <div class="app-section">
                    <img src="../img/erweima.jpg" alt="">
                    <p>品牌升级<br> 全新体验<br>扫码咨询微信</p>
                </div>
                <div class="items last">
                    <div class="tel">
                        <h1></h1>
                        <p>免费咨询(咨询、建议)</p>
                        <a href=""><i></i>在线客服</a>
                        <br>
                        <br>
                        <p><span>400-710-0128</span>周一至周日 24小时</p>
                    </div>
                </div>
            </div>
        </div>
        <div class="container fotr">
            Copyright © 2019 郑州两岸企业管理有限公司 版权所有
        </div>
        <script src="../js/jquery.min.js"></script>
        <script src="../js/bootstrap.min.js"></script>
        <script>
            var table = document.getElementById("tab")
            var btns = document.querySelectorAll("#tab>tbody button"); //返回数组
            console.log(btns);
            var len = btns.length
            for (var i = 0; i < len; i++) {
                btns[i].onclick = function() {
                    var span = this.parentNode.children[1];
                    var txt = span.innerHTML;
                    if (this.innerHTML == "+") {
                        txt++
                    } else if (txt > 0) {
                        txt--
                    }
                    span.innerHTML = txt;
                    var price = this.parentNode.previousElementSibling.innerHTML.slice(1);
                    var sum = (price * txt).toFixed(2);
                    var xj = this.parentNode.nextElementSibling;
                    xj.innerHTML = "¥" + sum;
                    var total = 0;
                    var tds = document.querySelectorAll("table tbody tr:not(:last-child) td:last-child")
                    for (var i = 0; i < tds.length; i++) {
                        if (tds[i].innerHTML != "0")
                            total += parseFloat(tds[i].innerHTML.slice(1))
                    }
                    console.log(total);
                    table.querySelector("table tbody tr:last-child td:last-child").innerHTML = "¥" + total.toFixed(2);
                }
            }
            var zf = document.getElementById("zf")
            var zft = document.getElementById("zft")
            zf.onclick = function() {
                zft.style.bottom = "300px";
                zft.style.right = "600px"
            }
            zft.onclick = function() {
                zft.style.bottom = "";
                zft.style.right = ""
            }
        </script>
</body>

</html>